package com.jp.knowledge.my.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;

import com.jp.knowledge.R;
import com.jp.knowledge.my.base.RecycleVAdapter;
import com.jp.knowledge.my.base.RecycleVHolder;
import com.jp.knowledge.my.model.OptionSelectModel;

import java.util.List;

/**
 * @author gzejia 978862664@qq.com
 */
public class MyGradAdapter extends RecycleVAdapter<OptionSelectModel> {

    public MyGradAdapter(Context context, @NonNull List<OptionSelectModel> list) {
        super(context, list);
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_my_vip_grad;
    }

    @Override
    public void onBind(RecycleVHolder holder, int position) {
        OptionSelectModel model = getData(position);

        holder.setImageResource(R.id.item_grad_iv, model.mImage);
        holder.setTextView(R.id.item_grad_tv_value, model.mContent);
//        ((TextView) holder.get(R.id.item_grad_tv_value)).setTextColor(context.getResources()
//                .getColor(model.isSelect ? R.color.white : R.color.gray_light));
        if (position == 0) {
            holder.get(R.id.item_grad_v_left).setVisibility(View.INVISIBLE);
        }
        holder.getConvertView().setAlpha(model.isSelect ? 1.0f : 0.5f);
    }
}
